package cn.rengy.web.framework.wxmp.jsapi;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.rengy.lang.ResultEntity;

@Controller
@RequestMapping(value = "/wx/jsapi")
public class JsapiController {
	private static Logger logger = LoggerFactory.getLogger(JsapiController.class);
	@Autowired
	private JsapiService jsapiService;
	/**
	 * 初始化指定公众号的微信接口
	 * @param paramMap
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="/signature")
	@ResponseBody
	public ResultEntity<?> signature(@RequestBody Map<String,Object> paramMap) throws Exception{
		String url=(String)paramMap.get("url");
		String appid=(String)paramMap.get("appid");
		//url=IWebUtils.urlDecode(url);
		return ResultEntity.ok(jsapiService.signature(appid,url));
    }
}
